<!-- 特殊规则设置 -->
<template>
  <dt-modal-info
    ref="info"
    title="特殊规则设置"
    :label-width="130"
    :width="800"
    :showOk="true"
    okText="提前关闭"
    @ok="onOk"></dt-modal-info>
</template>

<script>
  import checkMgr from '../opt/check.js'
  import sopApi from '@/biz/buildingManagement/sopConfig'

  export default {
    components: {},
    data() {
      return {
        info: {
          delayDay: null,
          ruleStartTime: null,
          ruleEndTime: null,
          sopName: '',
          id: null
        }
      }
    },
    methods: {
      show(data) {
        this.info = { ...data.sopRule }
        this.info.sopName = data.sopName
        this.info.id = data.id
        this.$refs.info.show(checkMgr.options(this), this.info)
      },
      onOk() {
        sopApi
          .earlyShutdown1({
            configId: this.info.id,
            level: 4,
            orgId: this.$dt.buildInfo().housesId
          })
          .then((res) => {
            this.$Message.success('关闭成功')
            this.$emit('success')
            this.$refs.info.hide()
          })
      }
    }
  }
</script>
